package com.ck.roomdemo.room;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao    // Database access object
public interface StudentDao {
    @Insert
    void insert(Student...students);

    @Update
    void update(Student...students);

    @Delete
    void delete(Student...students);

    @Query("DELETE FROM STUDENT")
    void deleteAll();

    @Query("SELECT * FROM STUDENT ORDER BY ID DESC")
    LiveData<List<Student>> getAll();
}
